package com.example.blog.model;

import com.example.blog.enmus.ResultCodeEnum;
import lombok.Data;
import org.springframework.boot.autoconfigure.graphql.GraphQlProperties;

import java.lang.ref.PhantomReference;

@Data
public class Result<T> {
    private int code;
    private String srrMsg;
    private T data;

    public static <T>Result success(T data){
        Result result = new Result();
        result.setCode(ResultCodeEnum.SUCCESS.getCode());
        result.setData(data);
        return result;

    }

    public static <T>Result fail(String errMsg){
        Result result = new Result();
        result.setCode(ResultCodeEnum.FAIL.getCode());
        result.setSrrMsg(errMsg);
        return result;
    }


}
